package com.hmdp.controller;


import com.hmdp.dto.Result;
import com.hmdp.service.IFollowService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 虎哥
 * @since 2021-12-22
 */
@RestController
@RequestMapping("/follow")
public class FollowController {

    @Resource
    private IFollowService followService;

    @PutMapping("/{id}/{subscribe}")
    public Result subscribe(@PathVariable("id") Long subscribeUserId,@PathVariable Boolean subscribe){
        return followService.subscribe(subscribeUserId,subscribe);
    }

    @GetMapping("/or/not/{id}")
    public Result isSubscribe(@PathVariable("id") Long subscribeUserId) {
        return followService.isSubscribe(subscribeUserId);
    }

    @GetMapping("/common/{id}")
    public Result subscribeCommons(@PathVariable("id") Long id){
        return followService.subscribeCommons(id);
    }
}
